/**
 * Created by 小敏哥 on 2017/3/22.
 */
import React, {Component} from 'react';
import style from './inputItem.scss';

class InputItem extends Component {
    constructor(props) {
        super(props);
        this.onBlurCallBack=this.onBlurCallBack.bind(this);
    }

    //焦点离开回调
    onBlurCallBack(event){
        this.props.onBlur&&this.props.onBlur(event.target.value)
    }

    render() {
        return <div className={this.props.showUnderLine ? style.inputItem + ' ' + style.underLine : style.inputItem}>
            <div>{this.props.itemText}</div>
            <input defaultValue={this.props.defaultValue} value={this.props.value} placeholder={this.props.placeHolder} onChange={this.props.onChange} onBlur={this.onBlurCallBack} maxLength={this.props.maxLength} type={this.props.type}/>
        </div>
    }
}

export default InputItem